﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using HumanResorcesProj.BLL;
using System.Web.UI.WebControls;
using System.Collections;

namespace HumanResorcesProj.GUI
{
    public partial class SearchEmplyee : System.Web.UI.Page
    {

        public static CurrEmp Curr = new CurrEmp();  

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void fillSubprojddl()
        {

            AssoDomainBLL bll = new AssoDomainBLL();

            DAL._HR_DS.AssoDomainDataTable SubProj;
            DropDownList ddl1 = new DropDownList();
            ddl1 = (DropDownList)FormView2.FindControl("DropDownList4");
            SubProj = bll.GetSubProj(ddl1.SelectedValue);

            ArrayList Name = new ArrayList();
            
            //Hashtable Name = new Hashtable();

            Name.Add(Convert.ToString(SubProj[0][4]));
            for (int i = 1; SubProj.Rows.Count > i; i++)
            {

                bool check = true;
                for (int j = 0; Name.Count > j; j++)
                {
                    string proj = Convert.ToString(SubProj[i][4]);
                    if (Name[j].Equals(proj))
                    {
                        check = false;

                    }


                }
                if (check) Name.Add(Convert.ToString(SubProj[i][4]));
            }
            DropDownList ddl = new DropDownList();
            ddl = (DropDownList)FormView2.FindControl("DropDownList5");
            ddl.DataSource = Name;
            ddl.DataTextField = null;
            ddl.DataValueField = null;
            ddl.DataBind();


        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.GridView1.Visible = true;
        }

        protected void childrenButton_Click(object sender, EventArgs e)
        {
            string url = "Extensions/ChildAddNew.aspx?ID=1&cat=test";
            string fullURL = "window.open('" + url + "', '_blank', 'height=400,width=840,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,titlebar=no' );";
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);

        }

        protected void ChildView_Click(object sender, EventArgs e)
        {
            string url = "Extensions/ChildAddNew.aspx?ID=1&cat=test";
            string fullURL = "window.open('" + url + "', '_blank', 'height=400,width=840,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,titlebar=no' );";
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);

        }

        protected void FeedBackTalksButton_Click(object sender, EventArgs e)
        {
            string url = "Extensions/FeedBackNew.aspx?ID=1&cat=test";
            string fullURL = "window.open('" + url + "', '_blank', 'height=400,width=840,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no' );";
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);

        }

        protected void UploadFileButton_Click(object sender, EventArgs e)
        {
            string url = "Extensions/UploadFileNew.aspx?ID=1&cat=test";
            string fullURL = "window.open('" + url + "', '_blank', 'height=400,width=840,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no' );";
            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);

        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Curr.CurrEmpID = GridView1.SelectedValue.ToString();
            Curr.CurrEmpName = GridView1.SelectedRow.Cells[1].Text;  
            Curr.CurrEmpLastName = GridView1.SelectedRow.Cells[2].Text;   

        }


        protected void FormView2_ItemDeleted(object sender, FormViewDeletedEventArgs e)
        {
            Response.Redirect("SearchEmplyee.aspx");
        }

        protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
        {
            fillSubprojddl();
        }

        protected void EditButton_Click(object sender, EventArgs e)
        {
            
        }
       

       

       

       

        

      
    }
}
